package uumoi

class Region implements Comparable<Region> {
	String name
	String description

	Country country

	@Override
	int compareTo(Region o) {
		return name.compareTo(o.name)
	}

	static belongsTo = [account: Account]
	static hasMany = [taxes: Tax, duties: Duty]

	static constraints = {
		description nullable: true
	}

	static canAccess(Long id, Account account) {
		return executeQuery("select r.id from Region r where :id = r.id and :account = r.account", [id: id, account: account])
	}
}
